'use strict'
import * as vscode from 'vscode'
import statusbar from "./statusbar"

export function activate(context: vscode.ExtensionContext) {
    statusbar.initStatusBar(context)
    if (vscode.workspace.rootPath) {
        if (true) {
            statusbar.showButton()
        } else {
            statusbar.configTarget("Target undefine")
            statusbar.hideButtion()
        }

        let buildTask = vscode.commands.registerCommand('easy-aos.buildTask', () => {
            vscode.commands.executeCommand('workbench.action.tasks.runTask', 'easy-aos: BuildTask');
        })

        let build = vscode.commands.registerCommand('easy-aos.build', () => {
            vscode.commands.executeCommand('workbench.action.tasks.runTask', 'easy-aos: Build');
        })

        let flash = vscode.commands.registerCommand('easy-aos.flash', () => {
            vscode.commands.executeCommand('workbench.action.tasks.runTask', 'easy-aos: Flash');
        })

        let monitor = vscode.commands.registerCommand('easy-aos.monitor', () => {
            vscode.commands.executeCommand('workbench.action.tasks.runTask', 'easy-aos: Monitor');
        })

        let clean = vscode.commands.registerCommand('easy-aos.clean', () => {
            vscode.commands.executeCommand('workbench.action.tasks.runTask', 'easy-aos: Clean');
        })

        let setTarget = vscode.commands.registerCommand('easy-aos.setTarget', () => {
            vscode.window.showInformationMessage("actions.seTarget.Target has changed %s")
        })

        context.subscriptions.push(buildTask, build, flash, monitor, clean, setTarget)
    } else {
        statusbar.hideButtion()
    }
}

export function deactivate() {

}